import { request } from "@/utils/http";
import React from "react";
import { GetHospitalSetListResponse, GetHospitalSetListParam, IAddHospitalParam, HospitalSetListItem, IUpdateHospitalParam } from "./model/hospitalSetTypes";
import exp from "constants";


// 获取医院分页列表
export const reqHospitalSetList = ({ page, limit, ...params }: GetHospitalSetListParam) => {
    return request.get<any, GetHospitalSetListResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params
    })
}

// 添加医院
export const reqAddHospital = (hospitalParam: IAddHospitalParam) => {
    return request.post<any, null>('/admin/hosp/hospitalSet/save', hospitalParam)
}

// 删除医院
export const reqDeleteHospital = (id: number) => {
    return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

/**
 * 
 * @param id 路由参数
 * @returns 对应的医院信息
 */
export const reqGetHospital = (id: number) => {
    return request.get<any, HospitalSetListItem>(`/admin/hosp/hospitalSet/get/${id}`)
}

/**
 * 
 * @param data IUpdateHospitalParam
 * @returns null 修改医院信息
 */
export const reqUpdateHospital = (data: IUpdateHospitalParam) => {
    return request.put<any, null>(`/admin/hosp/hospitalSet/update`, data)
}

/**
 * 
 * @param param 要删除的KEY
 * @returns 
 */
// 批量删除医院
export const reqDeleteGroupHospitals = (param: React.Key[]) => {
    return request.delete<any, null>('/admin/hosp/hospitalSet/batchRemove', { data: param })
} 